<template>
  <div class="synchronouspewstyle">
    <!-- 标题 -->
    <h2>{{ datas.text }}</h2>
    <!-- 类型选择 -->
    <!-- <div class="placeHolderstyle">
      <p>选择链接：</p>
      <div class="opText">
        <select-link @selectThisLink="selectThisLink" :linktypeurl="interurl" />
      </div>
    </div> -->
    <el-form label-width="80px" :model="datas" size="small">
      <h5 style="color: #000; font-size: 14px">图片上传</h5>
      <!-- 上传背景图 -->
      <div class="backgroundImg" @click="uploadI">
        <img v-if="!datas.bgImg" draggable="false" src="../../../assets/images/imgs.png" alt="" />
        <img v-else draggable="false" :src="datas.bgImg" alt="" />
        <span>上传背景图</span>
      </div>
    </el-form>
    <!-- 上传图片 -->
    <uploadimg ref="upload" @uploadInformation="uploadInformation" />
  </div>
</template>

<script>
import SelectLink from "../../selectLink";
import uploadimg from "../../uploadImg"; // 图片上传
export default {
  name: "Synchronouspewstyle",
  components: { 
    SelectLink, 
    uploadimg 
  },
  props: {
    datas: Object,
  },
  data() {
    return {
      interurl: "",
    };
  },
  methods: {
    selectThisLink(resu) {
      this.datas.apiUrl = resu;
    },
    uploadI() {
      this.$refs.upload.showUpload();
    },
    uploadInformation(res) {
      this.datas.bgImg = res;
    }
  },
  created() {
    this.interurl = this.datas.apiUrl;
  },
};
</script>

<style scoped lang="scss">
.synchronouspewstyle {
  width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  padding: 0 10px 20px;
  box-sizing: border-box;
  /* 标题 */
  h2 {
    padding: 24px 16px 24px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #f2f4f6;
    font-size: 18px;
    font-weight: 600;
    color: #323233;
  }
  .placeHolderstyle {
    // padding: 20px 0;
    p {
      display: block;
      margin-bottom: 10px;
    }
  }

  /* 背景图 */
  .backgroundImg {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    width: 100px;
    height: 100px;
    position: relative;
    background: #f2f4f6;
    margin-bottom: 30px;
    img {
      width: 100%;
      height: auto;
    }
    span {
      position: absolute;
      left: 0;
      bottom: 0;
      width: 100%;
      height: 40px;
      color: #fff;
      background: rgba(0, 0, 0, 0.5);
      text-align: center;
      line-height: 40px;
    }
  }
  .lef-height {
    .el-form-item__label {
      text-align: left;
      width: 80px;
      float: left;
    }
    .el-form-item__content {
      margin-left: 80px;
    }
  }
}
</style>
